home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1599 / 1431 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  3.5 KB

  1. From: itschere@techfak.uni-bielefeld.de
  2. Subject: audit user id patch
  3. Date: Sun, 22 May 94 16:50:59 MET DST
  4.  
  5.  Hello!
  6.  
  7.  Looks like I've found my 'diff' again. :-) Here comes a patch to implement
  8. the audit user id as known under SUN-OS. It can only be changed once from 0
  9. to any other value and never back. You can therefore always find out who the
  10. initially logged in user was, no matter what access right he has gained by
  11. means of setuid/seteuid.
  12.  
  13.  The patch also contains a basic structure for supplementary groups, say, the
  14. system calls are implemented, but they don't do anything yet. Point is that I
  15. don't know if I'll have enough time to fully implement them, but I just want
  16. to push things forward a bit... :-)
  17.  
  18. ciao,
  19. teSche
  20. --
  21. Torsten Scherer (TeSche, Schiller...)
  22. Faculty of Technology, University of Bielefeld, Germany, Europe, Earth...
  23. | Use any of "finger itschere@129.70.131.2-15" for adresses and more.    |
  24. | Last updated: Probably yesterday.                    |
  25.  
  26.  
  27.  
  28. --- dos.c.orig    Sun May 22 10:54:48 1994
  29. +++ dos.c    Sun May 22 11:22:42 1994
  30. @@ -8,7 +8,7 @@
  31.  
  32.  #include "mint.h"
  33.  
  34. -#define DOS_MAX 0x144
  35. +#define DOS_MAX 0x148
  36.  
  37.  Func dos_tab[DOS_MAX];
  38.  short dos_max = DOS_MAX;
  39. @@ -208,7 +208,6 @@
  40.      return EACCDN;
  41.  }
  42.  
  43. -
  44.  /* uk: set effective uid/gid but leave the real uid/gid unchanged. */
  45.  long ARGS_ON_STACK
  46.  p_seteuid(id)
  47. @@ -232,6 +231,43 @@
  48.      return EACCDN;
  49.  }
  50.  
  51. +/*  ts: audit user id functions, these id's never change once set to != 0
  52. + * and can therefore be used to determine who the initially logged in user was.
  53. + */
  54. +long ARGS_ON_STACK
  55. +p_getauid(id)
  56. +    int id;
  57. +{
  58. +    return curproc->auid;
  59. +}
  60. +
  61. +long ARGS_ON_STACK
  62. +p_setauid(id)
  63. +    int id;
  64. +{
  65. +    if (curproc->auid)
  66. +        return EACCDN;
  67. +
  68. +    return (curproc->auid = id);
  69. +}
  70. +
  71. +/* ts: basic structure for supplementary groups, not yet fully supported */
  72. +long ARGS_ON_STACK
  73. +p_getgroups(gidsetlen, gidset)
  74. +    int gidsetlen;
  75. +    int gidset[];
  76. +{
  77. +    return 0;
  78. +}
  79. +
  80. +long ARGS_ON_STACK
  81. +p_setgroups(ngroups, gidset)
  82. +    int ngroups;
  83. +    int gidset[];
  84. +{
  85. +    return EACCDN;
  86. +}
  87. +
  88.  /*
  89.   * a way to get/set process-specific user information. the user information
  90.   * longword is set to "arg", unless arg is -1. In any case, the old
  91. @@ -464,7 +500,7 @@
  92.          case 2:
  93.              return MAX_OPEN;
  94.          case 3:
  95. -            return 0;
  96. +            return NGROUPMAX;
  97.          case 4:
  98.              return UNLIMITED;
  99.          default:
  100. @@ -651,4 +687,8 @@
  101.      dos_tab[0x142] = s_yield;    /* dummy for d_xreaddir */
  102.      dos_tab[0x143] = p_seteuid;
  103.      dos_tab[0x144] = p_setegid;
  104. +    dos_tab[0x145] = p_getauid;
  105. +    dos_tab[0x146] = p_setauid;
  106. +    dos_tab[0x147] = p_getgroups;
  107. +    dos_tab[0x148] = p_setgroups;
  108.  }
  109. --- proc.h.orig    Sun May 22 10:58:14 1994
  110. +++ proc.h    Sun May 22 11:20:26 1994
  111. @@ -219,6 +219,11 @@
  112.      struct    proc *q_next;        /* next process on queue    */
  113.      struct     proc *gl_next;        /* next process in system    */
  114.      char    stack[STKSIZE+4];    /* stack for system calls    */
  115. +
  116. +    short    auid;            /* ts: audit user id */
  117. +#define    NGROUPMAX    8
  118. +    short    ngroups;        /* ts: number of supplementary groups */
  119. +    short    ngroup[NGROUPMAX];    /* ts: supplementary groups */
  120.  } PROC;
  121.  
  122.  
  123. --- proto.h.orig    Sun May 22 10:54:54 1994
  124. +++ proto.h    Sun May 22 11:13:06 1994
  125. @@ -80,6 +80,10 @@
  126.  long ARGS_ON_STACK p_setgid P_((int id));
  127.  long ARGS_ON_STACK p_seteuid P_((int id));
  128.  long ARGS_ON_STACK p_setegid P_((int id));
  129. +long ARGS_ON_STACK p_getauid P_((int id));
  130. +long ARGS_ON_STACK p_setauid P_((int id));
  131. +long ARGS_ON_STACK p_getgroups P_((int gidsetlen, int gidset[]));
  132. +long ARGS_ON_STACK p_setgroups P_((int ngroups, int gidset[]));
  133.  long ARGS_ON_STACK p_usrval P_((long arg));
  134.  long ARGS_ON_STACK p_umask P_((unsigned mode));
  135.  long ARGS_ON_STACK p_domain P_((int arg));
  136.